/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dis.model;

import java.sql.Connection;
import java.sql.DriverManager;


/**
 *
 * @author Manuel Lap
 */
public class ConnectBD {
    
    private DatosConfiguracion datosConfig;
    private Connection connection;
    
    public ConnectBD(){
        datosConfig = new DatosConfiguracion();
        
    }
    
    public void conect(){
        try{
            Class.forName("com.mysql.jdbc.Driver");
            connection = DriverManager.getConnection("jdbc:mysql://" + datosConfig.getHost() 
                                                                     + ":" 
                                                                     + datosConfig.getPuerto()
                                                                     + "/" 
                                                                     + datosConfig.getNombreBd(), 
                                                                     datosConfig.getNameUser(), 
                                                                     datosConfig.getPass());
            
            
        }
        catch(Exception ex){
            System.out.println("Error");
        }
    }
    
    public void close(){}
        
    public void commit(){}
    
    public void rollBack(){}

    /**
     * @return the datosConfig
     */
    public DatosConfiguracion getDatosConfig() {
        return datosConfig;
    }

    /**
     * @param datosConfig the datosConfig to set
     */
    public void setDatosConfig(DatosConfiguracion datosConfig) {
        this.datosConfig = datosConfig;
    }

    /**
     * @return the connection
     */
    public Connection getConnection() {
        return connection;
    }

    /**
     * @param connection the connection to set
     */
    public void setConnection(Connection connection) {
        this.connection = connection;
    }
}
